/*
 * TitledBorderFactory
 * 
 * Version: 1.0: This class is responsible for providing the borders with given color, text and style
 *
 * Date: 12/05/2010
 * 
 * Licensed under Eclipse open source license  
 */
package slhs.tempo.scriptGenerator;

import java.awt.Color;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;

public class TitledBorderFactory {
	private Color borderColor;
	private String borderTitleFont;
	private int borderTitleFontType;
	private int fontSize;

	public TitledBorderFactory(Color borderColor, String borderTitleFont,
			int borderTitleFontType, int fontSize) {

		this.borderTitleFontType = borderTitleFontType;
		this.borderTitleFont = borderTitleFont;
		this.borderColor = borderColor;
		this.fontSize = fontSize;
	}

	public TitledBorder getTitledBorder(String borderTitle) {

		Border border = BorderFactory.createLineBorder(borderColor);
		Font font = new Font(borderTitleFont, borderTitleFontType, fontSize);
		TitledBorder titledBorder = BorderFactory.createTitledBorder(border,
				borderTitle, TitledBorder.DEFAULT_JUSTIFICATION,
				TitledBorder.DEFAULT_POSITION, font);
		titledBorder.setTitleColor(borderColor);
		return titledBorder;
	}
}
